package com.rent.bean;

public class Car {
	
	private int carid;
	private int bid;
	private int tid;
	public int getBid() {
		return bid;
	}

	public void setBid(int bid) {
		this.bid = bid;
	}

	public int getTid() {
		return tid;
	}

	public void setTid(int tid) {
		this.tid = tid;
	}

	private String cbrand;
	private double cprice;
	private int cstatus;
	private int cgrade;
	private String ctype;
	private int isdelete;
	private int seat;
	private String gearbox;
	private String carNumber;
	private String engineNumber;
	//1:车辆空闲，可租；2:车辆租出；3：车辆报修;4:车辆在修;5:已报废移除 6：有违章
	public String status_detailed;
	//汽车押金 1级的3000 2级的4000 3级的5000.....
	public double car_deposit = 2000;
	//违章押金 默认2000
	public double violation_deposit = 2000;
	//油箱
	private int gasolineVolume;
	private int gasolineActualVolume;
	private int gasolineNumber;
	private String color;
	public int num;
	

	public Car(int carid, String cbrand, double cprice, int cstatus, int cgrade, String ctype, int isdelete, int seat,
			String gearbox, String carNumber, String engineNumber, int gasolineVolume, int gasolineActualVolume,
			int gasolineNumber, String color) {
		super();
		this.carid = carid;
		this.cbrand = cbrand;
		this.cprice = cprice;
		this.setCstatus(cstatus);
		this.cgrade = cgrade;
		this.ctype = ctype;
		this.isdelete = isdelete;
		this.seat = seat;
		this.gearbox = gearbox;
		this.carNumber = carNumber;
		this.engineNumber = engineNumber;
		this.gasolineVolume = gasolineVolume;
		this.gasolineActualVolume = gasolineActualVolume;
		this.gasolineNumber = gasolineNumber;
		this.color = color;
	}

	public String getColor() {
		return color;
	}

	public void setColor(String color) {
		this.color = color;
	}

	public Car(int carid, String cbrand, double cprice, int cstatus, int cgrade, String ctype,
			int isdelete, int seat, String gearbox, String carNumber, String engineNumber, int gasolineVolume,
			int gasolineActualVolume, int gasolineNumber) {
		super();
		this.carid = carid;
		this.cbrand = cbrand;
		this.cprice = cprice;
		this.setCstatus(cstatus);
		this.cgrade = cgrade;
		this.ctype = ctype;
		this.isdelete = isdelete;
		this.seat = seat;
		this.gearbox = gearbox;
		this.carNumber = carNumber;
		this.engineNumber = engineNumber;
		this.gasolineVolume = gasolineVolume;
		this.gasolineActualVolume = gasolineActualVolume;
		this.gasolineNumber = gasolineNumber;
	}

	public int getGasolineNumber() {
		return gasolineNumber;
	}

	public void setGasolineNumber(int gasolineNumber) {
		this.gasolineNumber = gasolineNumber;
	}

	public String getStatus_detailed() {
		return status_detailed;
	}

	public void setStatus_detailed(String status_detailed) {
		this.status_detailed = status_detailed;
	}

	public int getSeat() {
		return seat;
	}

	public void setSeat(int seat) {
		this.seat = seat;
	}

	public String getGearbox() {
		return gearbox;
	}

	public void setGearbox(String gearbox) {
		this.gearbox = gearbox;
	}

	public String getCarNumber() {
		return carNumber;
	}

	public void setCarNumber(String carNumber) throws Exception {
		if(carNumber.matches("^[京津沪渝冀豫云辽黑湘皖鲁新苏浙赣鄂桂甘晋蒙陕吉闽贵粤青藏川宁琼使领A-Z]{1}[A-Z]{1}[A-Z0-9]{4}[A-Z0-9挂学警港澳]{1}$")) {
			this.carNumber = carNumber;
		}else {
			throw new Exception("车牌号格式不正确");
		}
	}

	public String getEngineNumber() {
		return engineNumber;
	}

	public void setEngineNumber(String engineNumber) {
		this.engineNumber = engineNumber;
	}

	public Car() {}
	
	public Car(int carid,String cbrand,double cprice,int cstatus,int cgrade,String ctype,int isdelete) {
		this.carid=carid;
		this.cbrand=cbrand;
		this.cprice=cprice;
		this.setCstatus(cstatus);
		this.setCgrade(cgrade);
		this.ctype=ctype;
		this.isdelete=isdelete;
	}
	
	public Car(int carid, String cbrand, double cprice, int cstatus, int cgrade, String ctype,
			int isdelete, int seat, String gearbox, String carNumber, String engineNumber, String status_detailed) {
		super();
		this.carid = carid;
		this.cbrand = cbrand;
		this.cprice = cprice;
		this.setCstatus(cstatus);
		this.setCgrade(cgrade);
		this.ctype = ctype;
		this.isdelete = isdelete;
		this.seat = seat;
		this.gearbox = gearbox;
		this.carNumber = carNumber;
		this.engineNumber = engineNumber;
		this.status_detailed = status_detailed;
	}
	

	public Car(int carid, String cbrand, double cprice, int cstatus, int cgrade, String ctype,
			int isdelete, int seat, String gearbox, String carNumber, String engineNumber) {
		super();
		this.carid = carid;
		this.cbrand = cbrand;
		this.cprice = cprice;
		this.setCstatus(cstatus);
		this.setCgrade(cgrade);
		this.ctype = ctype;
		this.isdelete = isdelete;
		this.seat = seat;
		this.gearbox = gearbox;
		this.carNumber = carNumber;
		this.engineNumber = engineNumber;
	}
	

	

	public Car(int carid, String cbrand, double cprice, int cstatus, int cgrade, String ctype,
			int isdelete, int seat, String gearbox, String carNumber, String engineNumber, int gasolineVolume,
			int gasolineActualVolume) {
		super();
		this.carid = carid;
		this.cbrand = cbrand;
		this.cprice = cprice;
		this.setCstatus(cstatus);
		this.setCgrade(cgrade);
		this.ctype = ctype;
		this.isdelete = isdelete;
		this.seat = seat;
		this.gearbox = gearbox;
		this.carNumber = carNumber;
		this.engineNumber = engineNumber;
		this.gasolineVolume = gasolineVolume;
		this.gasolineActualVolume = gasolineActualVolume;
	}

	public int getGasolineVolume() {
		return gasolineVolume;
	}

	public void setGasolineVolume(int gasolineVolume) {
		this.gasolineVolume = gasolineVolume;
	}

	public int getGasolineActualVolume() {
		return gasolineActualVolume;
	}

	public void setGasolineActualVolume(int gasolineActualVolume) {
		this.gasolineActualVolume = gasolineActualVolume;
	}
	public Car(String cbrand, String ctype) {
		super();
		this.cbrand = cbrand;
		this.ctype = ctype;
	}

	public int getCarid() {
		return carid;
	}
	public void setCarid(int carid) {
		this.carid = carid;
	}
	public String getCbrand() {
		return cbrand;
	}
	public void setCbrand(String cbrand) {
		this.cbrand = cbrand;
	}
	public double getCprice() {
		return cprice;
	}
	public void setCprice(double cprice) {
		this.cprice = cprice;
	}
	public int getCstatus() {
		return cstatus;
	}
	public void setCstatus(int cstatus) {
		//1:车辆空闲，可租；2:车辆租出；3：车辆报修;4:车辆在修;5:已报废移除 6：有违章
		if(cstatus>0&&cstatus<7) {
			switch (cstatus) {
			case 1:
				this.setStatus_detailed("空闲");
				break;
			case 2:
				this.setStatus_detailed("租出");
				break;
			case 3:
				this.setStatus_detailed("报修");
				break;
			case 4:
				this.setStatus_detailed("在修");
				break;
			case 5:
				this.setStatus_detailed("报废");
				break;
			}
		}
		this.cstatus = cstatus;
	}
	public int getCgrade() {
		return cgrade;
	}
	public void setCgrade(int cgrade) {
		car_deposit +=cgrade*1000;
		this.cgrade = cgrade;
	}
	public String getCtype() {
		return ctype;
	}
	public void setCtype(String ctype) {
		this.ctype = ctype;
	}

	public int getIsdelete() {
		return isdelete;
	}

	public void setIsdelete(int isdelete) {
		this.isdelete = isdelete;
	}
	
	
	
	
}
